//
//  SISSContractAddPictureCell.m
//  SISSAPP
//
//  Created by 袁应荣 on 2017/10/11.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSContractAddPictureCell.h"
#import "SISSUploadImageView.h"

@interface SISSContractAddPictureCell()<SISSUploadImageViewDelegate>

@property (weak, nonatomic) UILabel *titleLabel;
@property (weak, nonatomic) SISSUploadImageView *uploadImageView;
@property (weak, nonatomic) UIView *bottomLine;

@end
@implementation SISSContractAddPictureCell

#pragma mark - SISSUploadImageViewDelegate
- (void)handlePhotoFinishedAction {
    if ([self.delegate respondsToSelector:@selector(contractAddPictureCellChoosePicture)]) {
        [self.delegate contractAddPictureCellChoosePicture];
    }
}

#pragma mark - UI
- (void)initUI {
    [super initUI];
    
    self.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.font = [UIFont systemFontOfSize:16];
    titleLabel.textColor = MAIN_TEXT_COLOR;
    titleLabel.text = @"家私家电照片：";
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    SISSUploadImageView *uploadImageView = [[SISSUploadImageView alloc] init];
    uploadImageView.isHiddenTitle = YES;
    [self.contentView addSubview:uploadImageView];
    uploadImageView.delegate = self;
    self.uploadImageView = uploadImageView;
    
    UIView *bottomLine = [[UIView alloc] init];
    bottomLine.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:bottomLine];
    self.bottomLine = bottomLine;
    
    WeakSelf
    CGFloat margin = 8.0;
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.contentView).offset(margin);
        make.top.equalTo(weakSelf.contentView).offset(margin);
    }];
    
    [self.uploadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(weakSelf.contentView);
        make.top.equalTo(weakSelf.titleLabel.mas_bottom).offset(margin);
    }];
    
    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.uploadImageView.mas_bottom).offset(1.5 * margin);
        make.left.right.bottom.equalTo(weakSelf.contentView);
        make.height.mas_equalTo(1);
    }];
}



@end
